import { HttpMethod } from '@/services/types';
import { request } from '@/api/request';

/**
 * GET /collect/:id 我的收藏
 * @param id
 * @param options
 */
export async function resCollect(id: number, options?: { [key: string]: any }) {
  return request<API.PaginationResult<API.CollectStruct>>('/collect/' + id, {
    method: HttpMethod.GET,
    ...(options || {}),
  });
}

/**
 * POST /collect/:id 收藏和取消
 * @param id
 * @param options
 */
export async function resAddOrCancelCollect(
  id: number,
  options?: { [key: string]: any },
) {
  return request<API.CollectStruct>('/collect/' + id, {
    method: HttpMethod.POST,
    ...(options || {}),
  });
}

/**
 * GET /collect/is/:id 是否收藏
 * @param id
 * @param options
 */
export async function resIsCollect(
  id: number,
  options?: { [key: string]: any },
) {
  return request<API.CollectStruct>('/collect/is/' + id, {
    method: HttpMethod.GET,
    ...(options || {}),
  });
}
